#pragma GCC optimize(2, "Ofast", "inline")
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <algorithm>
#define endl '\n'
#define int long long
#define pii pair<int, int>
#define fi first
#define se second
#define int128 __int128_t
using namespace std;

// 已知
string s, t;
// 未知
unordered_map<char, int> mp;
signed main()
{
    cin.tie(0)->sync_with_stdio(0);
    cin >> s >> t;
    int n = s.size(), m = t.size();
    for (int i = 0;i < m;++i)
    {
        mp[t[i]]++;
    }
    for (int i = 1;i < n;++i)
    {
        if (s[i] >= 'A' and s[i] <= 'Z')
        {
            if (mp[s[i - 1]] == 0)
            {
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
    return 0;
}

